Package-level declarations

Types

Link copied to clipboard
data class EndpointInfo(val summary: String? = null, val description: String? = null, val deprecated: Boolean? = null) : OperationModule, RouteOpenAPIModule
Link copied to clipboard
abstract class OpenAPIRoute<T : OpenAPIRoute<T>>(val ktorRoute: Route, val provider: CachingModuleProvider)
Link copied to clipboard
data class StatusCode(val code: HttpStatusCode) : StatusProvider, RouteOpenAPIModule
Link copied to clipboard
Link copied to clipboard
data class ThrowsInfo(val exceptions: List<APIException<*, *>>) : ThrowInfoProvider

Properties

Link copied to clipboard
val OpenAPIRoute<*>.application: Application

Functions

Link copied to clipboard
fun Application.apiRouting(config: NormalOpenAPIRoute.() -> Unit)

Wrapper for io.ktor.routing.routing to create the endpoints while configuring OpenAPI documentation at the same time.

fun Route.apiRouting(config: NormalOpenAPIRoute.() -> Unit)

Wrapper for io.ktor.server.routing.routing to create the endpoints while configuring OpenAPI documentation at the same time.

Link copied to clipboard
inline fun OpenAPIRoute<*>.exitAPI(crossinline fn: Route.() -> Unit)
Link copied to clipboard
fun info(summary: String? = null, description: String? = null, deprecated: Boolean? = null): EndpointInfo

Adds a summary, description and deprecation flag for the endpoint being configured

Link copied to clipboard
fun makeExceptionHandler(info: Array<out APIException<*, *>>): suspend PipelineContext<*, PipelineCall>.(t: Throwable) -> Unit
Link copied to clipboard
fun <TRoute : OpenAPIRoute<TRoute>> TRoute.method(method: HttpMethod): TRoute

inline fun <TRoute : OpenAPIRoute<TRoute>> TRoute.method(method: HttpMethod, crossinline fn: TRoute.() -> Unit)

Creates a new route matching the specified method

Link copied to clipboard
inline fun <TParams : Any, TResponse : Any, TRequest : Any, TRoute : OpenAPIRoute<TRoute>> TRoute.preHandle(exampleResponse: TResponse? = null, exampleRequest: TRequest? = null, noinline handle: TRoute.() -> Unit)
Link copied to clipboard

inline fun <TRoute : OpenAPIRoute<TRoute>> TRoute.provider(vararg content: ContentTypeProvider, crossinline fn: TRoute.() -> Unit)

Creates a new route matching the specified content

Link copied to clipboard

Success response status code of the endpoint will be derived from the @Response annotation

Link copied to clipboard
inline fun <T : OpenAPIRoute<T>> T.responseAnnotationStatus(crossinline fn: T.() -> Unit)

Success response status code of the endpoints defined in the block will be derived from the @Response annotation

Link copied to clipboard
fun <T : OpenAPIRoute<T>> T.route(path: String): T

inline fun <TRoute : OpenAPIRoute<TRoute>> TRoute.route(path: String, crossinline fn: TRoute.() -> Unit)

Creates a new route matching the specified path

Link copied to clipboard
fun status(code: HttpStatusCode): StatusCode
fun status(code: Int): StatusCode

Sets the success response status code of the endpoint

Link copied to clipboard
inline fun <T : OpenAPIRoute<T>> T.status(code: HttpStatusCode, crossinline fn: T.() -> Unit)
inline fun <T : OpenAPIRoute<T>> T.status(code: Int, crossinline fn: T.() -> Unit)

Sets the success response status code of the endpoints defined in the block

Link copied to clipboard

Applies a tag to all children of this route. Parameter tag should be an enum that inherits from APITag, check APITag description for an explanation.

inline fun <TRoute : OpenAPIRoute<TRoute>> TRoute.tag(tag: APITag, crossinline fn: TRoute.() -> Unit)

This method assigns an OpenAPI tag too all child routes defined inside fn. Parameter tag should be an enum that inherits from APITag, check APITag description for an explanation.

Link copied to clipboard
fun tags(vararg tags: APITag): TagModule
Link copied to clipboard
inline fun <T : OpenAPIRoute<T>, EX : Throwable> T.throws(status: HttpStatusCode, crossinline fn: T.() -> Unit = {}): T
inline fun <T : OpenAPIRoute<T>> T.throws(vararg responses: APIException<*, *>, crossinline fn: T.() -> Unit = {}): T
inline fun <T : OpenAPIRoute<T>, EX : Throwable, B> T.throws(status: HttpStatusCode, example: B? = null, noinline gen: (EX) -> B? = null, crossinline fn: T.() -> Unit = {}): T

inline fun <T : OpenAPIRoute<T>, EX : Throwable> T.throws(status: HttpStatusCode, exClass: KClass<EX>, crossinline fn: T.() -> Unit = {}): T
inline fun <T : OpenAPIRoute<T>, EX : Throwable, B> T.throws(status: HttpStatusCode, example: B? = null, exClass: KClass<EX>, crossinline fn: T.() -> Unit = {}): T

exists for simpler syntax